﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WeatherBar2
{
    public partial class Settings : Form
    {
        public Settings()
        {
            InitializeComponent();
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            intCounter.Value = Properties.Settings.Default.UpdateTime;

            if (Properties.Settings.Default.IsMetric)
                rbC.Checked = true;
            else
                rbF.Checked = true;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.UpdateTime = Convert.ToInt32(intCounter.Value);

            if (rbC.Checked)
                Properties.Settings.Default.IsMetric = true;
            else
                Properties.Settings.Default.IsMetric = false;

            Properties.Settings.Default.Save();

            ((Main)this.Owner).pnlRefresh.Visible = true;
            ((Main)this.Owner).DoWork();

            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
